package com.zhh.front.task;

import com.zhh.api.service.IncomeService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Component("taskManager")
public class TaskManager {

    //定时任务功能，要求：公共方法，没有参数，没有返回值

    @DubboReference(interfaceClass = IncomeService.class,version="1.0")
    private IncomeService incomeService;

    //生成收益计划
    @Scheduled(cron = "0 0 1 * * ?")
    public void invokeGenerateIncomePlan(){
        incomeService.generateIncomePlan();
    }

    //收益返还给用户
    @Scheduled(cron = "0 0 2 * * ?")
    public void invokeGenerateIncomeBack(){
        incomeService.generateIncomeBack();
    }


}
